#ifndef data_deal_h
#define data_deal_h

#ifndef ZLIB_WINAPI
#define ZLIB_WINAPI
#endif

#include <zlib.h>
#include <vector>
#include <assert.h>
#include "xml.h"
#include "thread.h"
#include "data_stream.h"

#pragma comment(lib, "zlibwapi.lib")

#define CHUNK 16384

class CDataDeal : public CThread{
public:
	CDataDeal();
	~CDataDeal();
	void initialize(CDataStream * n_DataStream);
	void run();

private:
	CDataStream * m_DataStream;

protected:
	int compress(char * outbuf, char * inbuf, int inlen);
	int diff(void * buffer, FILE * file);
	void execute();

private:
	char * m_FileName;
	XMLNode m_AppNode;
	XMLNode m_ChildNode;
	FILE * m_File;
	char * m_Buffer;
	char * m_TempBuf;
};

#endif